<template>
  <!-- This section should be hidden by default and shown when there are todos -->
  <section class="main">
    <input id="toggle-all" class="toggle-all" type="checkbox" />
    <label for="toggle-all">Mark all as complete</label>
    <ul class="todo-list">
      <!-- These are here just to show the structure of the list items -->
      <!-- List items should get the class `editing` when editing and `completed` when marked as completed -->
      <li
        :class="{ completed: item.isDone }"
        v-for="(item, index) in obj"
        :key="index"
      >
        <div class="view">
          <input class="toggle" type="checkbox" v-model="item.isDone" />
          <label>{{ item.name }}</label>
          <button class="destroy" @click="delFn(index)"></button>
        </div>
      </li>
    </ul>
  </section>
</template>

<script>
export default {
  props: ["obj"],
  methods: {
    delFn(index) {
        if(confirm("确定要删除么?")){
      this.$emit("del-todo", index);
        }
    },
  },
};
</script>

<style>
</style>